<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta name="author" content="www.cnadlm.com" />
<link href="<?=domain?>static/style/union.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?=domain?>static/script/core.js" charset="utf-8"></script>
<script type="text/javascript" src="<?=domain?>static/script/home.js" charset="utf-8"></script>
<title><?=name?>-添加站点</title>
<body>
<div class="nav">
	<div class="list">
		<ul>
		  <?php
		  foreach($menu as $key=>$value){
		  ?>
		  <li><a href="<?=($value['value'])?>"><?=$value['name']?></a></li>
		  <?php
		  }
		  ?>
		 </ul>
	</div>
</div>
<div class="main">
	<div class="logo"><a href="<?=domain?>"><img src="<?=domain?>static/image/Logo.png"></a></div>
	<div class="content">
		<div class="home_nav">
			<div class="l"></div>
			<div class="c">
		        <ul>
		          <?php
		          	$current=-1;
					foreach($HomeMenu as $key=>$value){
						if(stripos($_SERVER['SCRIPT_NAME'],substr($value['value'],0,strpos($value['value'],'/')))){
							$current=$key;
						}
				  ?>
		          <li<?=($current==$key?' class="sel"':'')?>><a href="<?=domain?>home/<?=$value['value']?>"><?=$value['name']?></a></li>
		          <?php
					}
		          ?>
		          <li><a href="<?=domain?>action/logout.php">安全退出</a></li>
		        </ul>
			</div>
			<div class="r"></div>
		</div>
		<div class="manage">
			<div class="left">
				<div class="module">
					<div class="bar"><div><?=($HomeMenu[$current]['name'])?>&nbsp;>&nbsp;添加广告位</div></div>
					<div class="handle">
						<?php
							if(!empty($message)){
								foreach($message['msg'] as $key => $value){
						?>
						<div class="message <?=$message['result']?'success':'error';?>">
							<div class="msg"><?=$message['msg'][$key]?></div>
							<div class="close"></div>
						</div>
						<?php
							}}
							if($code===true){
								$data=$board.','.$format.','.$usage.','.$modality.','.implode('-',$adcolumn);
						?>
						<div class="action info">广告位代码(<font color="red">请务修改代码,修改后将影响您的广告收入.</font>)</div>
						<div class="form" style="position:relative;">
						  <div wrap="off" copy="true" class="copy" style="width:500px;height:190px;margin-left:120px;">
							&lt;script type="text/javascript" src="<?=$config['server']?>cnad.js" charset="utf-8"&gt;&lt;/script&gt;<br/>
							&lt;script type="text/javascript"&gt;<br/>
							Q.B.M='<?=$data?>';<br/>
							Q.B.V='<?=md5($config['verify'].$data)?>';<br/>
							Q.GO();<br/>
							&lt;/script>
						  </div>
						  <div class="zcopy" style="width:505px;height:193px;position:absolute;top:0px;left:120px;"></div>
						</div>
						<?php
							}else{
						?>
						<form name="append" method="post" action="<?=domain?>home/module/system.php?action=append" onsubmit="return DdvertSub();">
						<input type="hidden" name="board" value="<?=$board?>"/>
						<div class="action info">广告位信息</div>
						<div class="form">
							<div class="m">广告位名称：</div>
							<div class="s"><input type="text" name="name" value="<?=$name?>" size="30" maxlength="255"/></div>
							<div class="e c"><font color="red">*</font>,此广告位的名称.</div>
						</div>
						<div class="form">
							<div class="m">广告位标签：</div>
							<div class="s">
								<div class="append" id="append"><span>▼</span>&nbsp;<?php if(empty($adcolumn)){?><label alt="添加此广告位标签">添加此广告位标签</label><input type="hidden" name="adcolumn" value=""/><?php }else{$temp='';foreach($adcolumn as $value){$temp.=$LabelKey[$value]['name'].',';}$temp=substr_replace($temp,'',-1,1);?><label alt="添加此广告位标签"><?=$temp?></label><input type="hidden" name="adcolumn" value="<?=implode(',',$adcolumn)?>"/><?php }?>
								</div>
								<div class="label">
									<?php
									$adcolumn=empty($adcolumn)?array():array_flip($adcolumn);
									foreach($LabelMenu as $key=>$value){
										echo '<div class="cap">'.$value['name'].'</div>';
										foreach($value['child'] as $k=>$v){
											echo '<a href="#" id="'.$v['id'].'"'.(isset($adcolumn[$v['id']])?' class="select"':'').'><div>'.$v['name'].'</div><span>'.$v['name'].'</span></a>';
										}
									}
									?>
									<div style="clear:both;"></div>
									<div class="label_sub"><input type="button" name="label" value="确定" class="bg"/></div>
								</div>
							</div>
							<div class="e c"><font color="red">*</font>,描述这个广告位.</div>
						</div>
						<div class="action info">广告信息</div>
						<div class="form">
							<div class="m">素材类型：</div>
							<div class="s">
								  <label><input type="radio" name="format" value="0" checked><span>全部</span></label>
								  <?php
						          foreach($formatList as $key=>$value){
						          ?>
						          <label><input type="radio" name="format" value="<?=$value['id']?>"<?php $format==$value['id']?' checked':''?>><span><?=$value['name']?></span></label>
								  <?php
								  }
						          ?>
							</div>
							<div class="e c"><font color="red">*</font>,广告素材类型.</div>
						</div>
						<div class="form">
							<div class="m">展现形式：</div>
							<div class="s">
								<select size="1" name="usage" style="width:255px;" id="usage">
									<option selected="selected" value="0">请选择显示方式...</option>
									<?php
										foreach($modalityMenu as $key=>$value){
											echo '<option value="'.$value['id'].'"'.($usage==$value['id']?' selected="selected"':'').'>'.$value['name'].'</option>';
										}
									?>
								</select>
							</div>
							<div class="e c"><font color="red">*</font>,广告在页面中的显示方式</div>
						</div>
						<div class="form">
							<div class="m">广告尺寸：</div>
							<div class="s">
								<select size="1" name="modality" style="width:255px;" id="modality">
									<option selected="selected" value="0">请选择尺寸...</option>
									<?php
									if(isset($modality)){
										echo '<option selected="selected" value="'.$modality.'">'.$ModalityKey[$modality]['name'].'</option>';
									}
									?>
								</select>
							</div>
							<div class="e c"><font color="red">*</font>,广告展现位置的大小.</div>
						</div>
						<div class="form"><input type="submit" name="submit" value="保存" class="bg"/></div>
						</form>
						<?php
							}
						?>
					</div>
				</div>
			</div>
			<div class="right">
				<div class="module">
					<div class="bar"><div><?=($HomeMenu[$current]['name'])?></div></div>
					<div class="handle">
						<?php
							foreach($HomeMenu[$current]['child'] as $key=>$value){
						?>
						<a href="<?=domain?>home/<?=$value['value']?>"><?=(stripos($_SERVER['SCRIPT_NAME'],strrchr($value['value'],'/'))!==false?'▬&nbsp;':'')?><?=$value['name']?></a>
						<?php
							}
						?>
					</div>
				</div>
			</div>
		</div>
		<div class="footer">
			<?=$foot?>
		</div>
	</div>
</div>
</body>
</html>
<script language="JavaScript" type="text/javascript">
  var modality=<?=json_encode($modalityMenu);?>;
  $('#usage').change(function(){
  		var select=parseInt($(this).attr('value')),html='';
  		if(select!=0){
	  		for(key in modality){
	  			if(modality[key]['id']==select){
	  				for(k in modality[key]['child']){
	  					html+='<option value="'+modality[key]['child'][k]['id']+'">'+modality[key]['child'][k]['name']+'</option>';
	  				}
	  				break;
	  			}
	  		}
  		}else{
  			html='<option selected="selected" value="0">请选择尺寸...</option>';
  		}
  		$('#modality').html(html);
  });
  ZeroClipboard.swf='<?=domain?>static/script/Clipboard.swf';
</script>